<?php
// $Id$

/**
 * 应用程序启动脚本
 */
global $g_boot_time;
$g_boot_time = microtime(true);

$app_config = require(dirname(__FILE__) . '/_code/config/boot.php');
require $app_config['QEEPHP_DIR'] . '/library/q.php';
require $app_config['APP_DIR'] . '/myapp.php';

// if is CLI
if (isset($argc) && $argc > 1) {
    $_SERVER['SCRIPT_NAME'] = $_SERVER['SCRIPT_FILENAME'] = __FILE__;

    // the $argv[0] is script file name
    // the $argv[1] is the first para, should be UDI
    QContext::instance()->changeRequestUDI($argv[1]);
}

$ret = MyApp::instance($app_config)->dispatching();
if (is_string($ret)) echo $ret;

return $ret;